gnttab: make the grant table lock a read-write lock
authorDavid Vrabel <david.vrabel@citrix.com>
Mon, 15 Jun 2015 11:25:20 +0000 (13:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 15 Jun 2015 11:25:20 +0000 (13:25 +0200)
commit40de9fffb4cc0b0485aa3391d72e2220b8e1ce12
treebf01cccf9dad72959a681edeca2fdc32e2afcff0
parent5a9899ddc42040e139233a6b1f0f65f3b65eda6d
gnttab: make the grant table lock a read-write lock

In combination with the per-active entry locks, the grant table lock
can be made a read-write lock since the majority of cases only the
read lock is required. The grant table read lock protects against
changes to the table version or size (which are done with the write
lock held).

The write lock is also required when two active entries must be
acquired.

The double lock is still required when updating IOMMU page tables.

With the lock contention being only on the maptrack lock (unless IOMMU
updates are required), performance and scalability is improved.

Based on a patch originally by Matt Wilson <msw@amazon.com>.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
docs/misc/grant-tables.txt
xen/arch/arm/mm.c
xen/arch/x86/mm.c
xen/common/grant_table.c
xen/include/xen/grant_table.h